package com.nantai.jiafang.nantaijiafang.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import com.nantai.jiafang.nantaijiafang.IConstant;
import com.nantai.jiafang.nantaijiafang.R;
import com.nantai.jiafang.nantaijiafang.activity.DataSearchActivity;
import com.nantai.jiafang.nantaijiafang.activity.ReportActivity;

/**
 * 数据查询
 */
public class FragSearchData extends Fragment implements View.OnClickListener {

    private LinearLayout mLlProductionOrder;
    private LinearLayout mLlFabricVatch;
    private LinearLayout mLlSupplier;
    private LinearLayout mLlProductionCost;
    private LinearLayout mLlPurchasecontract;
    private LinearLayout mLlReport;
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_frag_search_data, container, false);
    }

    @Override
    public void onActivityCreated(Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        init();
    }

    private void init() {
        mLlPurchasecontract = (LinearLayout)getView().findViewById(R.id.ll_purchase_contract);
        mLlProductionOrder = (LinearLayout) getView().findViewById(R.id.ll_production_order);
        mLlFabricVatch = (LinearLayout) getView().findViewById(R.id.ll_fabric_bathc);
        mLlSupplier = (LinearLayout) getView().findViewById(R.id.ll_supplier);
        mLlProductionCost = (LinearLayout) getView().findViewById(R.id.ll_production_cost);
        mLlReport = (LinearLayout) getView().findViewById(R.id.ll_report);

        mLlProductionOrder.setOnClickListener(this);
        mLlFabricVatch.setOnClickListener(this);
        mLlSupplier.setOnClickListener(this);
        mLlProductionCost.setOnClickListener(this);
        mLlPurchasecontract.setOnClickListener(this);
        mLlReport.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        Intent intent = new Intent();
        switch (v.getId()) {
            case R.id.ll_production_order:
                intent.putExtra(IConstant.INTENT, IConstant.INTENT_PRODUCTION_ORDER_ATTITUDE);
                intent.setClass(getActivity(), DataSearchActivity.class);
                startActivity(intent);
                break;
            case R.id.ll_fabric_bathc:
                intent.putExtra(IConstant.INTENT, IConstant.INTENT_FabricBatch_ATTITUDE);
                intent.setClass(getActivity(), DataSearchActivity.class);
                startActivity(intent);
                break;
            case R.id.ll_supplier:
                intent.putExtra(IConstant.INTENT, IConstant.INTENT_SUPPLIER_ATTITUDE);
                intent.setClass(getActivity(), DataSearchActivity.class);
                startActivity(intent);
                break;
            case R.id.ll_production_cost:
                intent.putExtra(IConstant.INTENT, IConstant.INTENT_PRODUCTIONCOST_ATTITUDE);
                intent.setClass(getActivity(), DataSearchActivity.class);
                startActivity(intent);
                break;
            case R.id.ll_purchase_contract:
                intent.putExtra(IConstant.INTENT, IConstant.INTENT_PURCHASECONTRACT_ACCITUDE);
                intent.setClass(getActivity(), DataSearchActivity.class);
                startActivity(intent);
                break;
            case R.id.ll_report:
                intent.putExtra(IConstant.INTENT, IConstant.INTENT_PURCHASECONTRACT_ACCITUDE);
                intent.setClass(getActivity(), ReportActivity.class);
                startActivity(intent);
                break;
        }

    }
}
